﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class admin_Recruitment : System.Web.UI.Page
{
    string sql;
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminCs.CheckLoginState();
        if (!this.IsPostBack)
        {
            Areabig();
            if (Request.QueryString["j"] == "edit")
            {
                zp_txt();
                bind_a1();
                bind_a2();
                bind_a3();
            }
            else if (Request.QueryString["j"] == "del")
            {
                del_zp();
            }
        }
    }
    #region
    public void Areabig()//地区大类
    {
        sql = "select * from Area where oneid<>0 and twoid=0 and threeid=0 order by sort";
        DataTable dt = Class1.ExecSel(sql);
        Ddl_AreaOne.DataSource = dt;
        Ddl_AreaOne.DataTextField = "areaname";
        Ddl_AreaOne.DataValueField = "oneid";
        Ddl_AreaOne.DataBind();
    }
    protected void Ddl_AreaOne_SelectedIndexChanged(object sender, EventArgs e)
    {
        Ddl_AreaTwo.Items.Clear();
        Ddl_AreaTwo.Items.Add(new ListItem("全部", "0"));
        Ddl_AreaThree.Items.Clear();
        Ddl_AreaThree.Items.Add(new ListItem("全部", "0"));

        sql = "select * from Area where twoid<>0 and threeid=0 and oneid=" + Ddl_AreaOne.SelectedValue + " order by sort";
        DataTable dt = Class1.ExecSel(sql);
        Ddl_AreaTwo.DataSource = dt;
        Ddl_AreaTwo.DataTextField = "areaname";
        Ddl_AreaTwo.DataValueField = "twoid";
        Ddl_AreaTwo.DataBind();
    }
    protected void Ddl_AreaTwo_SelectedIndexChanged(object sender, EventArgs e)
    {
        Ddl_AreaThree.Items.Clear();
        Ddl_AreaThree.Items.Add(new ListItem("全部", "0"));

        sql = "select * from Area where threeid<>0 and oneid=" + Ddl_AreaOne.SelectedValue;
        sql += " and twoid=" + Ddl_AreaTwo.SelectedValue + " order by sort";
        DataTable dt = Class1.ExecSel(sql);
        Ddl_AreaThree.DataSource = dt;
        Ddl_AreaThree.DataTextField = "areaname";
        Ddl_AreaThree.DataValueField = "threeid";
        Ddl_AreaThree.DataBind();
    }
    public void bind_a1()//绑定省
    {
        int id = int.Parse(Request.QueryString["ID"]);
        DataTable dt = Class1.ExecSel("select * from ZhaoPin where j_ID=" + id + "");
        Session["dl"] = Convert.ToString(dt.Rows[0]["j_AreaOne"].ToString());

        sql = "select * from Area where oneid<>0 and twoid=0 and threeid=0 order by sort";
        DataTable dt2 = Class1.ExecSel(sql);
        this.Ddl_AreaOne.DataSource = dt2;
        this.Ddl_AreaOne.DataTextField = "areaname";
        this.Ddl_AreaOne.DataValueField = "oneid";
        this.Ddl_AreaOne.SelectedValue = Session["dl"].ToString();
        this.Ddl_AreaOne.DataBind();
    }
    public void bind_a2()//绑定市
    {
        int id = int.Parse(Request.QueryString["ID"]);
        DataTable dt = Class1.ExecSel("select * from ZhaoPin where j_ID=" + id + "");
        Session["zl"] = Convert.ToString(dt.Rows[0]["j_AreaTwo"].ToString());

        sql = "select * from Area where twoid<>0 and threeid=0 and oneid=" + Ddl_AreaOne.SelectedValue + " order by sort";
        DataTable dt2 = Class1.ExecSel(sql);
        this.Ddl_AreaTwo.DataSource = dt2;
        this.Ddl_AreaTwo.DataTextField = "areaname";
        this.Ddl_AreaTwo.DataValueField = "twoid";
        this.Ddl_AreaTwo.SelectedValue = Session["zl"].ToString();
        this.Ddl_AreaTwo.DataBind();
    }
    public void bind_a3()//绑定城市
    {
        int id = int.Parse(Request.QueryString["ID"]);
        DataTable dt = Class1.ExecSel("select * from ZhaoPin where j_ID=" + id + "");
        Session["xl"] = Convert.ToString(dt.Rows[0]["j_AreaThree"].ToString());

        sql = "select * from Area where threeid<>0 and oneid=" + Ddl_AreaOne.SelectedValue;
        sql += " and twoid=" + Ddl_AreaTwo.SelectedValue + " order by sort";
        DataTable dt2 = Class1.ExecSel(sql);
        this.Ddl_AreaThree.DataSource = dt2;
        this.Ddl_AreaThree.DataTextField = "areaname";
        this.Ddl_AreaThree.DataValueField = "threeid";
        this.Ddl_AreaThree.SelectedValue = Session["xl"].ToString();
        this.Ddl_AreaThree.DataBind();
    }
    #endregion

    #region
    public void add_zp()//执行添加
    {
        string j_Lock;
        string Company = TextBox11.Text;
        string Status = TextBox1.Text;
        string AreaOne = Ddl_AreaOne.SelectedValue;
        string AreaTwo = Ddl_AreaTwo.SelectedValue;
        string AreaThree = Ddl_AreaThree.SelectedValue;
        string Sex = DropDownList1.SelectedItem.Text;
        string Qualifications = DropDownList2.SelectedItem.Text;
        string Number = TextBox3.Text;
        string EndTime = DropDownList3.SelectedValue;
        string Salary = DropDownList4.SelectedItem.Text;
        string Whether = RadioButtonList1.SelectedItem.Text;
        string YaoQiu = TextBox4.Text;

        string Address = TextBox2.Text;
        string Contacts = TextBox5.Text;
        string Tel = TextBox6.Text;
        string Phone = TextBox7.Text;
        string Fax = TextBox8.Text;
        string Email = TextBox9.Text;
        string WebSite = TextBox10.Text;

        DateTime AddTime = DateTime.Now;
        if (this.CheckBox1.Checked)
        {
            j_Lock = "1";

        }
        else
        {

            j_Lock = "0";
        }
        if (Status == "")
        {
            Response.Write("<script>alert('请填写职位！');history.go(-1);</script>");
            return;
        }
        else if (Qualifications == "请选择")
        {
            Response.Write("<script>alert('请填写学历要求！');history.go(-1);</script>");
            return;
        }
        else if (EndTime == "请选择")
        {
            Response.Write("<script>alert('请选择有效时间！');history.go(-1);</script>");
            return;
        }
        else if (Salary == "请选择承诺月薪")
        {
            Response.Write("<script>alert('请选择承诺月薪！');history.go(-1);</script>");
            return;
        }
        else if (AreaOne == "0")
        {
            Response.Write("<script>alert('请选择省分类！');history.go(-1);</script>");
            return;
        }
        else if (AreaTwo == "0")
        {
            Response.Write("<script>alert('请选择市分类！');history.go(-1);</script>");
            return;
        }
        else if (AreaThree == "0")
        {
            Response.Write("<script>alert('请选择市区分类！');history.go(-1);</script>");
            return;
        }

        sql = "insert into ZhaoPin(j_Company,j_Status,j_AreaOne,j_AreaTwo,j_AreaThree,j_Sex,j_Qualifications,j_Number,j_EndTime,j_Salary,j_Whether,j_YaoQiu,j_Address,j_Contacts,j_Tel,j_Phone,j_Fax,j_Email,j_WebSite,j_AddTime,j_Lock)";
        sql += "values('" + Company + "','" + Status + "','" + AreaOne + "','" + AreaTwo + "'," + AreaThree + ",'" + Sex + "','" + Qualifications + "','" + Number + "','" + EndTime + "','" + Salary + "','" + Whether + "','" + YaoQiu + "','" + Address + "','" + Contacts + "'," + Tel + "," + Phone + "," + Fax + ",'" + Email + "','" + WebSite + "','" + AddTime + "','" + j_Lock + "')";
        Class1.ExecSql(sql);
        Class1.AlertShow("发布成功！", "Recruitment.aspx?j=add");

    }
    #endregion

    public void zp_txt()//显示文本信息
    {
        int ID = int.Parse(Request.QueryString["ID"]);
        sql = "select * from Zhaopin where j_ID=" + ID;
        DataTable dt = Class1.ExecSel(sql);
        TextBox11.Text = Convert.ToString(dt.Rows[0]["j_Company"]);
        TextBox1.Text = Convert.ToString(dt.Rows[0]["j_Status"]);
        TextBox3.Text = Convert.ToString(dt.Rows[0]["j_Number"]);
        TextBox4.Text = Convert.ToString(dt.Rows[0]["j_YaoQiu"]);

        TextBox2.Text = Convert.ToString(dt.Rows[0]["j_Address"]);
        TextBox5.Text = Convert.ToString(dt.Rows[0]["j_Contacts"]);
        TextBox6.Text = Convert.ToString(dt.Rows[0]["j_Tel"]);
        TextBox7.Text = Convert.ToString(dt.Rows[0]["j_Phone"]);
        TextBox8.Text = Convert.ToString(dt.Rows[0]["j_Fax"]);
        TextBox9.Text = Convert.ToString(dt.Rows[0]["j_Email"]);
        TextBox10.Text = Convert.ToString(dt.Rows[0]["j_WebSite"]);

        if (dt.Rows[0]["j_Lock"].ToString() == "1")
        {
            CheckBox1.Checked = true;
        }
        else
        {
            CheckBox1.Checked = false;
        }

        #region 性别
        if (dt.Rows[0]["j_Sex"].ToString().Trim() == "不限")
        {
            this.DropDownList1.Items[0].Selected = true;
            this.DropDownList1.Items[1].Selected = false;
            this.DropDownList1.Items[2].Selected = false;
        }
        else if (dt.Rows[0]["j_Sex"].ToString().Trim() == "男")
        {
            this.DropDownList1.Items[0].Selected = false;
            this.DropDownList1.Items[1].Selected = true;
            this.DropDownList1.Items[2].Selected = false;
        }
        else if (dt.Rows[0]["j_Sex"].ToString().Trim() == "女")
        {
            this.DropDownList1.Items[0].Selected = false;
            this.DropDownList1.Items[1].Selected = false;
            this.DropDownList1.Items[2].Selected = true;
        }
        #endregion

        #region　学历要求
        if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "无学历要求")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = true;
            this.DropDownList2.Items[2].Selected = false;
            this.DropDownList2.Items[3].Selected = false;
            this.DropDownList2.Items[4].Selected = false;
            this.DropDownList2.Items[5].Selected = false;
            this.DropDownList2.Items[6].Selected = false;
            this.DropDownList2.Items[7].Selected = false;
            this.DropDownList2.Items[8].Selected = false;
            this.DropDownList2.Items[9].Selected = false;
            this.DropDownList2.Items[10].Selected = false;
        }
        else if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "初中及初中以下")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = false;
            this.DropDownList2.Items[2].Selected = true;
            this.DropDownList2.Items[3].Selected = false;
            this.DropDownList2.Items[4].Selected = false;
            this.DropDownList2.Items[5].Selected = false;
            this.DropDownList2.Items[6].Selected = false;
            this.DropDownList2.Items[7].Selected = false;
            this.DropDownList2.Items[8].Selected = false;
            this.DropDownList2.Items[9].Selected = false;
            this.DropDownList2.Items[10].Selected = false;
        }
        else if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "高中")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = false;
            this.DropDownList2.Items[2].Selected = false;
            this.DropDownList2.Items[3].Selected = true;
            this.DropDownList2.Items[4].Selected = false;
            this.DropDownList2.Items[5].Selected = false;
            this.DropDownList2.Items[6].Selected = false;
            this.DropDownList2.Items[7].Selected = false;
            this.DropDownList2.Items[8].Selected = false;
            this.DropDownList2.Items[9].Selected = false;
            this.DropDownList2.Items[10].Selected = false;
        }
        else if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "职高/技校")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = false;
            this.DropDownList2.Items[2].Selected = false;
            this.DropDownList2.Items[3].Selected = false;
            this.DropDownList2.Items[4].Selected = true;
            this.DropDownList2.Items[5].Selected = false;
            this.DropDownList2.Items[6].Selected = false;
            this.DropDownList2.Items[7].Selected = false;
            this.DropDownList2.Items[8].Selected = false;
            this.DropDownList2.Items[9].Selected = false;
            this.DropDownList2.Items[10].Selected = false;
        }
        else if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "中专")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = false;
            this.DropDownList2.Items[2].Selected = false;
            this.DropDownList2.Items[3].Selected = false;
            this.DropDownList2.Items[4].Selected = false;
            this.DropDownList2.Items[5].Selected = true;
            this.DropDownList2.Items[6].Selected = false;
            this.DropDownList2.Items[7].Selected = false;
            this.DropDownList2.Items[8].Selected = false;
            this.DropDownList2.Items[9].Selected = false;
            this.DropDownList2.Items[10].Selected = false;
        }
        else if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "大专")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = false;
            this.DropDownList2.Items[2].Selected = false;
            this.DropDownList2.Items[3].Selected = false;
            this.DropDownList2.Items[4].Selected = false;
            this.DropDownList2.Items[5].Selected = false;
            this.DropDownList2.Items[6].Selected = true;
            this.DropDownList2.Items[7].Selected = false;
            this.DropDownList2.Items[8].Selected = false;
            this.DropDownList2.Items[9].Selected = false;
            this.DropDownList2.Items[10].Selected = false;
        }
        else if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "本科")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = false;
            this.DropDownList2.Items[2].Selected = false;
            this.DropDownList2.Items[3].Selected = false;
            this.DropDownList2.Items[4].Selected = false;
            this.DropDownList2.Items[5].Selected = false;
            this.DropDownList2.Items[6].Selected = false;
            this.DropDownList2.Items[7].Selected = true;
            this.DropDownList2.Items[8].Selected = false;
            this.DropDownList2.Items[9].Selected = false;
            this.DropDownList2.Items[10].Selected = false;
        }
        else if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "硕士")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = false;
            this.DropDownList2.Items[2].Selected = false;
            this.DropDownList2.Items[3].Selected = false;
            this.DropDownList2.Items[4].Selected = false;
            this.DropDownList2.Items[5].Selected = false;
            this.DropDownList2.Items[6].Selected = false;
            this.DropDownList2.Items[7].Selected = false;
            this.DropDownList2.Items[8].Selected = true;
            this.DropDownList2.Items[9].Selected = false;
            this.DropDownList2.Items[10].Selected = false;
        }
        else if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "博士")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = false;
            this.DropDownList2.Items[2].Selected = false;
            this.DropDownList2.Items[3].Selected = false;
            this.DropDownList2.Items[4].Selected = false;
            this.DropDownList2.Items[5].Selected = false;
            this.DropDownList2.Items[6].Selected = false;
            this.DropDownList2.Items[7].Selected = false;
            this.DropDownList2.Items[8].Selected = false;
            this.DropDownList2.Items[9].Selected = true;
            this.DropDownList2.Items[10].Selected = false;
        }
        else if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "博士后")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = false;
            this.DropDownList2.Items[2].Selected = false;
            this.DropDownList2.Items[3].Selected = false;
            this.DropDownList2.Items[4].Selected = false;
            this.DropDownList2.Items[5].Selected = false;
            this.DropDownList2.Items[6].Selected = false;
            this.DropDownList2.Items[7].Selected = false;
            this.DropDownList2.Items[8].Selected = false;
            this.DropDownList2.Items[9].Selected = true;
            this.DropDownList2.Items[10].Selected = false;
        }
        else if (dt.Rows[0]["j_Qualifications"].ToString().Trim() == "MBA")
        {
            this.DropDownList2.Items[0].Selected = false;
            this.DropDownList2.Items[1].Selected = false;
            this.DropDownList2.Items[2].Selected = false;
            this.DropDownList2.Items[3].Selected = false;
            this.DropDownList2.Items[4].Selected = false;
            this.DropDownList2.Items[5].Selected = false;
            this.DropDownList2.Items[6].Selected = false;
            this.DropDownList2.Items[7].Selected = false;
            this.DropDownList2.Items[8].Selected = false;
            this.DropDownList2.Items[9].Selected = false;
            this.DropDownList2.Items[10].Selected = true;
        }
        #endregion

        #region　有效时间
        if (dt.Rows[0]["j_EndTime"].ToString().Trim() == "7")
        {
            this.DropDownList3.Items[0].Selected = false;
            this.DropDownList3.Items[1].Selected = true;
            this.DropDownList3.Items[2].Selected = false;
            this.DropDownList3.Items[3].Selected = false;
            this.DropDownList3.Items[4].Selected = false;
            this.DropDownList3.Items[5].Selected = false;
            this.DropDownList3.Items[6].Selected = false;
            this.DropDownList3.Items[7].Selected = false;
        }
        else if (dt.Rows[0]["j_EndTime"].ToString().Trim() == "14")
        {
            this.DropDownList3.Items[0].Selected = false;
            this.DropDownList3.Items[1].Selected = false;
            this.DropDownList3.Items[2].Selected = true;
            this.DropDownList3.Items[3].Selected = false;
            this.DropDownList3.Items[4].Selected = false;
            this.DropDownList3.Items[5].Selected = false;
            this.DropDownList3.Items[6].Selected = false;
            this.DropDownList3.Items[7].Selected = false;
        }
        else if (dt.Rows[0]["j_EndTime"].ToString().Trim() == "30")
        {
            this.DropDownList3.Items[0].Selected = false;
            this.DropDownList3.Items[1].Selected = false;
            this.DropDownList3.Items[2].Selected = false;
            this.DropDownList3.Items[3].Selected = true;
            this.DropDownList3.Items[4].Selected = false;
            this.DropDownList3.Items[5].Selected = false;
            this.DropDownList3.Items[6].Selected = false;
            this.DropDownList3.Items[7].Selected = false;
        }
        else if (dt.Rows[0]["j_EndTime"].ToString().Trim() == "60")
        {
            this.DropDownList3.Items[0].Selected = false;
            this.DropDownList3.Items[1].Selected = false;
            this.DropDownList3.Items[2].Selected = false;
            this.DropDownList3.Items[3].Selected = false;
            this.DropDownList3.Items[4].Selected = true;
            this.DropDownList3.Items[5].Selected = false;
            this.DropDownList3.Items[6].Selected = false;
            this.DropDownList3.Items[7].Selected = false;
        }
        else if (dt.Rows[0]["j_EndTime"].ToString().Trim() == "90")
        {
            this.DropDownList3.Items[0].Selected = false;
            this.DropDownList3.Items[1].Selected = false;
            this.DropDownList3.Items[2].Selected = false;
            this.DropDownList3.Items[3].Selected = false;
            this.DropDownList3.Items[4].Selected = false;
            this.DropDownList3.Items[5].Selected = true;
            this.DropDownList3.Items[6].Selected = false;
            this.DropDownList3.Items[7].Selected = false;
        }
        else if (dt.Rows[0]["j_EndTime"].ToString().Trim() == "180")
        {
            this.DropDownList3.Items[0].Selected = false;
            this.DropDownList3.Items[1].Selected = false;
            this.DropDownList3.Items[2].Selected = false;
            this.DropDownList3.Items[3].Selected = false;
            this.DropDownList3.Items[4].Selected = false;
            this.DropDownList3.Items[5].Selected = false;
            this.DropDownList3.Items[6].Selected = true;
            this.DropDownList3.Items[7].Selected = false;
        }
        else if (dt.Rows[0]["j_EndTime"].ToString().Trim() == "360")
        {
            this.DropDownList3.Items[0].Selected = false;
            this.DropDownList3.Items[1].Selected = false;
            this.DropDownList3.Items[2].Selected = false;
            this.DropDownList3.Items[3].Selected = false;
            this.DropDownList3.Items[4].Selected = false;
            this.DropDownList3.Items[5].Selected = false;
            this.DropDownList3.Items[6].Selected = false;
            this.DropDownList3.Items[7].Selected = true;
        }
        #endregion

        #region 月薪
        if (dt.Rows[0]["j_Salary"].ToString().Trim() == "1000以下")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = true;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "1000～1999")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = true;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "2000～2999")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = true;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "3000～3999")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = true;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "4000～5999")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = true;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "6000～7999")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = true;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "8000～9999")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = true;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "10000～14999")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = true;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "15000～19999")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = true;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "20000～29999")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = true;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "30000～49999")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = true;
            this.DropDownList4.Items[12].Selected = false;
        }
        else if (dt.Rows[0]["j_Salary"].ToString().Trim() == "面议")
        {
            this.DropDownList4.Items[0].Selected = false;
            this.DropDownList4.Items[1].Selected = false;
            this.DropDownList4.Items[2].Selected = false;
            this.DropDownList4.Items[3].Selected = false;
            this.DropDownList4.Items[4].Selected = false;
            this.DropDownList4.Items[5].Selected = false;
            this.DropDownList4.Items[6].Selected = false;
            this.DropDownList4.Items[7].Selected = false;
            this.DropDownList4.Items[8].Selected = false;
            this.DropDownList4.Items[9].Selected = false;
            this.DropDownList4.Items[10].Selected = false;
            this.DropDownList4.Items[11].Selected = false;
            this.DropDownList4.Items[12].Selected = true;
        }
        #endregion

        #region 是否兼职
        if (dt.Rows[0]["j_Whether"].ToString() == "全职")
        {
            this.RadioButtonList1.Items[0].Selected = true;
            this.RadioButtonList1.Items[1].Selected = false;
            this.RadioButtonList1.Items[2].Selected = false;
        }
        else if (dt.Rows[0]["j_Whether"].ToString() == "兼职")
        {
            this.RadioButtonList1.Items[0].Selected = false;
            this.RadioButtonList1.Items[1].Selected = true;
            this.RadioButtonList1.Items[2].Selected = false;
        }
        else if (dt.Rows[0]["j_Whether"].ToString() == "临时")
        {
            this.RadioButtonList1.Items[0].Selected = false;
            this.RadioButtonList1.Items[1].Selected = false;
            this.RadioButtonList1.Items[2].Selected = true;
        }
        #endregion
    }
    #region
    public void edit_zp()//修改信息
    {
        string j_Lock;
        int ID = int.Parse(Request.QueryString["ID"]);
        string Company = TextBox11.Text;
        string Status = TextBox1.Text;
        string AreaOne = Ddl_AreaOne.SelectedValue;
        string AreaTwo = Ddl_AreaTwo.SelectedValue;
        string AreaThree = Ddl_AreaThree.SelectedValue;
        string Sex = DropDownList1.SelectedItem.Text;
        string Qualifications = DropDownList2.SelectedItem.Text;
        string Number = TextBox3.Text;
        string EndTime = DropDownList3.SelectedValue;
        string Salary = DropDownList4.SelectedItem.Text;
        string Whether = RadioButtonList1.SelectedItem.Text;
        string YaoQiu = TextBox4.Text;
        string Address = TextBox2.Text;
        string Contacts = TextBox5.Text;
        string Tel = TextBox6.Text;
        string Phone = TextBox7.Text;
        string Fax = TextBox8.Text;
        string Email = TextBox9.Text;
        string WebSite = TextBox10.Text;
        DateTime AddTime = DateTime.Now;
        if (this.CheckBox1.Checked)
        {
            j_Lock = "1";

        }
        else
        {

            j_Lock = "0";
        }
        if (Status == "")
        {
            Response.Write("<script>alert('请填写职位！');history.go(-1);</script>");
            return;
        }
        else if (Qualifications == "请选择")
        {
            Response.Write("<script>alert('请填写学历要求！');history.go(-1);</script>");
            return;
        }
        else if (EndTime == "请选择")
        {
            Response.Write("<script>alert('请选择有效时间！');history.go(-1);</script>");
            return;
        }
        else if (Salary == "请选择承诺月薪")
        {
            Response.Write("<script>alert('请选择承诺月薪！');history.go(-1);</script>");
            return;
        }
        else if (AreaOne == "0")
        {
            Response.Write("<script>alert('请选择省分类！');history.go(-1);</script>");
            return;
        }
        else if (AreaTwo == "0")
        {
            Response.Write("<script>alert('请选择市分类！');history.go(-1);</script>");
            return;
        }
        else if (AreaThree == "0")
        {
            Response.Write("<script>alert('请选择市区分类！');history.go(-1);</script>");
            return;
        }

        sql = "update ZhaoPin set j_Company='" + Company + "',j_Status='" + Status + "',j_AreaOne=" + AreaOne + ",j_AreaTwo=" + AreaTwo + ",j_AreaThree=" + AreaThree + ",j_Sex='" + Sex + "',j_Qualifications='" + Qualifications + "',j_Number='" + Number + "',j_EndTime='" + EndTime + "',j_Salary='" + Salary + "',j_Whether='" + Whether + "',j_YaoQiu='" + YaoQiu + "',j_Address='" + Address + "',j_Contacts='" + Contacts + "',j_Tel='" + Tel + "',j_Phone='" + Phone + "',j_Fax='" + Fax + "',j_Email='" + Email + "',j_WebSite='" + WebSite + "',j_Lock='" + j_Lock + "' where j_ID=" + ID + "";
        Class1.ExecSql(sql);
        Class1.AlertShow("修改成功！", "Recruitment2.aspx");
    }
    #endregion
    public void del_zp()//删除信息
    {
        int id = int.Parse(Request.QueryString["ID"]);
        string sql = "delete  ZhaoPin where j_ID=" + id;
        Class1.ExecSql(sql);
        Class1.AlertShow("删除成功！", "Recruitment2.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["j"] == "add")
        {
            add_zp();
        }
        else if (Request.QueryString["j"] == "edit")
        {
            edit_zp();
        }
    }
}
